#! /bin/bash
#$ -q 1-day
#$ -l h_vmem=5G
#$ -t 1-3:1
#$ -l loc2tmp=1G
#$ -M prodduturi.naresh@mayo.edu
#$ -m a
#$ -V
#$ -cwd
#$ -e /data4/bsi/bioinf_ext1/s112349.ucsf/UCSF_new_request_11_12_2012/temp/temp_custom/impute_logfiles_sungrid
#$ -o /data4/bsi/bioinf_ext1/s112349.ucsf/UCSF_new_request_11_12_2012/temp/temp_custom/impute_logfiles_sungrid
#$ -notify
date
tmp=/local2/tmp/m081429/`expr $RANDOM \* $RANDOM`
cleanup () {
/bin/rm -rf $tmp
}
trap 'cleanup' USR1 USR2 EXIT
mkdir -p $tmp
cd $tmp
t1=`pwd`
t2=`uname -n`
t3="$t1 $t2"
echo $t3 >> /data4/bsi/bioinf_ext1/s112349.ucsf/UCSF_new_request_11_12_2012/temp/temp_custom/impute_system
k=`cat  /data4/bsi/bioinf_ext1/s112349.ucsf/UCSF_new_request_11_12_2012/temp/temp_custom/ArrayJob_file_impute |head -$SGE_TASK_ID |tail -1`
/data4/bsi/RandD/Workflow/genotyping_1000genome_impute/bin/impute_v2.2.2_x86_64_static/impute2 $k -seed 123456789 

gzip impute_out_*
wait
k1=`cat  /data4/bsi/bioinf_ext1/s112349.ucsf/UCSF_new_request_11_12_2012/temp/temp_custom/Gunzip_file_impute |head -$SGE_TASK_ID |tail -1`
mv impute_out_*.gz $k1
rm -rf $tmp
echo $SGE_TASK_ID >>/data4/bsi/bioinf_ext1/s112349.ucsf/UCSF_new_request_11_12_2012/temp/temp_custom/impute_check_jobs

date
